package com.qf.dao;


import com.qf.pojo.entity.TbAccount;
import com.qf.pojo.request.TbAccountReq;
import com.qf.service.TbAdminService;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;
import org.springframework.stereotype.Service;

import java.util.List;


@Mapper
public interface AccountMapper {
//    @Select("select tba.* from tb_user_account tbua, tb_account tba where tbua.aid=tba.aid and tbua.uid=#{uid}")


    @Results(
            id = "TbAccountMap", value = {
            @Result(column = "aid", property = "aid"),
            @Result(column = "account_name", property = "accountname"),
            @Result(column = "account_card", property = "accountcard"),
            @Result(column = "card_money", property = "cardmoney"),
    })

    @Select("select * from tb_account where aid in (select aid from tb_user_account where uid=#{uid})")
    public List<TbAccount> findByUid(int uid);

    //修改卡信息
    @Update("update tb_account set account_name=#{accountname},account_card=#{accountcard},card_money=#{cardmoney} where aid=#{aid}")
    int update(TbAccountReq tbAccountReq);

//    查看卡信息
@ResultMap("TbAccountMap")
@Select("select * from tb_account")
    List<TbAccount> findAllAccount();



}
